package main

import "fmt"

func bubbleSort(arr *[10]int) {
	fmt.Println("排序前：", (*arr))
	for i := 0; i < len(*arr)-1; i++ {
		for j := 0; j < len(*arr)-1-i; j++ {
			temp := 0
			if (*arr)[j] > (*arr)[j+1] {
				temp = (*arr)[j]
				(*arr)[j] = (*arr)[j+1]
				(*arr)[j+1] = temp
			}
		}
	}
	fmt.Println("排序后：", (*arr))
}

func main() {
	arr := [10]int{4, 11, 12, 77, 31, 4342, 122, 6, 9, 10}
	bubbleSort(&arr)
}
